<?php
namespace app\zmt\validate;


use think\Validate;

class NewsVaildate extends  Validate
{
    protected $rule = [
        'title' => 'require|max:30|min:1',
        'image' => 'require',
        'abstract' => 'require',
        'author' => 'require',
        'name' => 'require',
        'look_num' => 'require|integer',
    ];


    protected $message=[
        'title.require' => '标题不能为空',
        'title.max' => '标题不能超过30个字',
        'title.min' => '标题至少一个字',
        'image.require' => '请上传图片',
        'abstract.require' => '请上传图片',
        'author.require' => '请上传作者信息',
        'look_num.require' => '浏览量不能为空',
        'name.require' => '商品名称不能为空',
    ];

    protected $scene=[
        'add' => ['title','abstract','content','author'],
        'edit' => ['title','abstract','content','author'],
        'add2' => ['title'],
        'edit2' => ['title'],
        'edit3' => ['image'],
        'add1' => ['name']
    ];
}